//
//  MyWebViewController.m
//  MyWeb
//
//  Created by smu on 11-7-27.
//  Copyright 2011年 duk. All rights reserved.
//

#import "MyWebViewController.h"

@implementation MyWebViewController
@synthesize mywebView;

- (IBAction)urlbuttonTapped
{
    NSURL *url = [NSURL URLWithString:@"http://www.apple.com.cn"];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [self.mywebView loadRequest:request];
}

- (void)dealloc
{
    mywebView.delegate = nil;
    [mywebView release];
    [super dealloc];
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
    self.mywebView.delegate = self;
    [super viewDidLoad];
}


- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return YES;
}

#pragma mark -
#pragma mark UIWebViewDelegate
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
    UIAlertView *buttonAlert = [[UIAlertView alloc] initWithTitle:@"Welcome to apple" 
                                                          message:@"The home page has finished loading. Thanks for visiting!" 
                                                         delegate:nil cancelButtonTitle:@"Continue" otherButtonTitles:nil];
    [buttonAlert show];
    [buttonAlert release];
}

@end
